From 5333aa48f3f8799e9d5233fd2603b6be7a046b7b Mon Sep 17 00:00:00 2001 From: "cl349@firebug.cl.cam.ac.uk" Date: Tue, 13 Sep 2005 21:24:03 +0000 Subject: [PATCH] Don't cause watch fire deadlock by unconditionally rewriting the sysrq node. Signed-off-by: Christian Limpach --- linux-2.6-xen-sparse/arch/xen/kernel/reboot.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c b/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c index 2358970468..b6608cef49 100644 --- a/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c +++ b/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c @@ -355,16 +355,26 @@ static void shutdown_handler(struct xenbus_watch *watch, const char *node) static void sysrq_handler(struct xenbus_watch *watch, const char *node) { char sysrq_key = '\0'; - + int err; + + again: + err = xenbus_transaction_start("control"); + if (err) + return; if (!xenbus_scanf("control", "sysrq", "%c", &sysrq_key)) { printk(KERN_ERR "Unable to read sysrq code in control/sysrq\n"); - return; + xenbus_transaction_end(1); + return; } - xenbus_printf("control", "sysrq", "%c", '\0'); + if (sysrq_key != '\0') + xenbus_printf("control", "sysrq", "%c", '\0'); - if (sysrq_key != '\0') { + err = xenbus_transaction_end(0); + if (err == -ETIMEDOUT) + goto again; + if (sysrq_key != '\0') { #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) handle_sysrq(sysrq_key, NULL, NULL); #else -- 2.30.2